package com.HomeWorkhsp.Chapter07;

/**
 * Enjoy programming!!!
 * Time: 2021/11/10 -  20:04
 */
public class Test08 {
    public static void main(String[] args) {
        Music m = new Music("夜曲", 5.34);
        System.out.println(m.getInfo());
        m.play();
    }
}

class Music {
    String name;
    double time;

    public Music(String name, double time) {
        this.name = name;
        this.time = time;
    }

    public void play() {
        System.out.println("正在播放中。。" + this.name + " 时长：" + this.time);
    }

    public String getInfo() {
        return "name = " + this.name + '\n' + "time = " + this.time;
    }
}
